<?php

/* author:  dkloz */
function BL_editEntity($categoryId, $entityId, $Attrvals)
{
	$category = DB_getCategory($categoryId);

	if(is_null($category))
	{
		return BL_ERROR_IN_INSERT_ENTITY;
	}

	$entity = DB_getEntity($entityId);

	$i = 0;
	foreach($entity->GetAttributes() as $attr){
		$attr->SetValue($Attrvals[$i]);
		$i++;
	}

 	$return_value = DB_entity_updateattributevalues($entity);

	if ($return_value < 0)
	{
		return BL_ERROR_IN_EDIT_ENTITY;
	}
	else
	{
		return BL_OK;
	}
}

?>
